/*
 * Copyright (c) 2023 iQi.Co.Ltd. All rights reserved.
 */
 
using IQIGame.Onigao.Framework;
using System.Collections.Generic;
using System.Linq;
using System;
using NetProtocol.Enum;

namespace NetProtocol.POD {

	/// <summary>
	/// 
	/// module : battleLogic
	/// </summary>
	public class BattleEndPOD : IPOD 
    {
        public readonly static Func<BattleEndPOD> FACTORY = () => new BattleEndPOD();
		public static Func<BattleEndPOD> DynamicFactory = FACTORY;
        
		/*-- members --*/
		/// <summary>
        /// 
        /// </summary>
		public long battleId;
		/// <summary>
        /// 
        /// </summary>
		public BattleType battleType;
		/// <summary>
        /// 
        /// </summary>
		public long hostPlayerId;
		/// <summary>
        /// 
        /// </summary>
		public BattleTeamId successTeam;
		
		
		
		/*-- constructors --*/
		public BattleEndPOD() {}
		public BattleEndPOD(long battleId, BattleType battleType, long hostPlayerId, BattleTeamId successTeam) {
			this.battleId = battleId;
			this.battleType = battleType;
			this.hostPlayerId = hostPlayerId;
			this.successTeam = successTeam;
		}
	      public void Serial(SOutputStream _out) {
            _out.Write_long(battleId);
            _out.Write_byte((sbyte)battleType);
            _out.Write_long(hostPlayerId);
            _out.Write_byte((sbyte)successTeam);
        }
        
        public void UnSerial(SInputStream _in) {
            if(!_in.HasRemaining()) return;
            battleId = _in.Read_long();
            if(!_in.HasRemaining()) return;
            battleType = (BattleType)_in.Read_byte();
            if(!_in.HasRemaining()) return;
            hostPlayerId = _in.Read_long();
            if(!_in.HasRemaining()) return;
            successTeam = (BattleTeamId)_in.Read_byte();
        }
		
		public BattleEndPOD Clone() {
            BattleEndPOD o = DynamicFactory();
            o.battleId = battleId;
            o.battleType = battleType;
            o.hostPlayerId = hostPlayerId;
            o.successTeam = successTeam;
            return o;
        }
        
        public void Clear() {
            battleId = default;
            battleType = default;
            hostPlayerId = default;
            successTeam = default;
        }
		
        public override string ToString() {
			string str = "";
			str += "BattleEndPOD [";
			str += "battleId=";
			str += battleId;
			str += ", battleType=";
			str += battleType;
			str += ", hostPlayerId=";
			str += hostPlayerId;
			str += ", successTeam=";
			str += successTeam;
			str += "]";
			return str;
		}
		
	}
}